---
import type { HTMLAttributes } from 'astro/types'

interface Props extends HTMLAttributes<'a'> {
  href: string
}

const { href, ...attrs } = Astro.props

const isExternal = href.startsWith('http')
---

<a
  class="hover:text-accent"
  href={href}
  target={isExternal ? '_blank' : undefined}
  rel={isExternal ? 'noopener noreferrer' : undefined}
  {...attrs}><slot /></a
>
